package com.ruoyi.common.business.dao;

import com.ruoyi.common.business.entity.YytHomeAdv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 首页轮播广告 Mapper 接口
 * </p>
 *
 * @author huangshun
 * @since 2021-12-16
 */
@Repository
public interface YytHomeAdvMapper extends BaseMapper<YytHomeAdv> {

    /**
     * 获取app端轮播图列表
     */
    @Select("select cast(id as char) as id, `name`, pic as image, url from yyt_home_adv where " +
            "`status` = 1 order by sort asc")
    List<Map<String, String>> clientSwiperList(@Param("today") String today);

    /**
     * 增加轮播图点击数
     */
    @Select("update yyt_home_adv set click_count = click_count + 1 where id = #{id}")
    void increaseClickCount(@Param("id") String id);
}
